#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'tian'
__data__ = '2021/12/6 10:24'
# software: PyCharm

from django import forms

from apps.app01 import models

from .bootstrap import BootStrapForm


class WikiModelForm(BootStrapForm, forms.ModelForm):
    def __init__(self, request, *args, **kwargs):
        super().__init__(*args, **kwargs)
        table_data_list = [("", "请选择"), ]
        data_list = models.It.objects.all().values_list("pk", "it_name")
        table_data_list.extend(data_list)
        self.fields["project"].choices = table_data_list

    class Meta:
        model = models.Wiki
        exclude = ["depth"]
